package com.renfei.multimediatask.ui.task11;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.renfei.multimediatask.Course;
import com.renfei.multimediatask.R;
import com.renfei.multimediatask.adapter.OpenGLCourseAdapter;
import com.renfei.multimediatask.base.BaseActivity;
import com.renfei.multimediatask.ui.task1.DrawImageActivity;
import com.renfei.multimediatask.ui.task10.VideoPlayActivity;
import com.renfei.multimediatask.ui.task11.filter.BlackWhiteFBOPreviewActivity;
import com.renfei.multimediatask.ui.task11.preview.OpenglCamera2PreviewActivity;
import com.renfei.multimediatask.ui.task11.preview.OpenglCameraPreviewActivity;
import com.renfei.multimediatask.ui.task11.rotate.OpenglCameraRotatePreviewActivity;
import com.renfei.multimediatask.ui.task11.rotate.OpenglCameraRotateTexturePreviewActivity;
import com.renfei.multimediatask.ui.task11.scale.OpenglCameraScaleTexturePreviewActivity;
import com.renfei.multimediatask.ui.task11.watermark.TextWaterMarkFBOPreviewActivity;
import com.renfei.multimediatask.ui.task11.watermark.TextWaterMarkPreviewActivity;
import com.renfei.multimediatask.ui.task2.AudioGatherAndPlayActivity;
import com.renfei.multimediatask.ui.task3.CamerPreviewActivity;
import com.renfei.multimediatask.ui.task4.Hard_Encode_DecodeActivity;
import com.renfei.multimediatask.ui.task5.OpenGLDrawTriangleActivity;
import com.renfei.multimediatask.ui.task6.OpenGLDrawImageActivity;
import com.renfei.multimediatask.ui.task7.AacEncodecAndDecodecActivity;
import com.renfei.multimediatask.ui.task8.VideoEncodecDecodecActivity;
import com.renfei.multimediatask.ui.task9.prefect.VideoRecordAllProcessPrefect;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * OpenGL高级特性
 */
public class OpenGLAdvancedContent extends BaseActivity {


    @BindView(R.id.rv_opengl_advanced)
    RecyclerView rvOpenglAdvanced;
    private ArrayList<Course> courseList;
    private OpenGLCourseAdapter openGLCourseAdapter;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_open_g_l_advanced_content;
    }

    @Override
    protected void initListener() {
        courseList = new ArrayList<>();
        courseList.add(new Course("1.使用camera1 与OpenGL 结合预览", ""));
        courseList.add(new Course("2.使用camera2 与OpenGL 结合预览", ""));
        courseList.add(new Course("3.使用矩阵来修正预览方向", ""));
        courseList.add(new Course("4.通过修改纹理坐标来修正预览方向", ""));
        courseList.add(new Course("5.预览有些形变， 通过放大缩小 来修正", ""));
        courseList.add(new Course("6.实现以下水印", ""));
        courseList.add(new Course("7.使用FBO实现 6 未实现功能", ""));
        courseList.add(new Course("8.基于7的功能，修改着色，实现黑白滤镜", ""));
//        courseList.add(new Course("3.视频的    水印", "使用OpenGL处理摄像头预览帧处理"));
//        courseList.add(new Course("4.视频的    滤镜", "使用OpenGL处理摄像头预览帧处理"));


        rvOpenglAdvanced.setLayoutManager(new LinearLayoutManager(this));

        openGLCourseAdapter = new OpenGLCourseAdapter(courseList);

        openGLCourseAdapter.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
                switch (position) {
                    case 0:
                        startActivity(OpenglCameraPreviewActivity.class);
                        break;
                    case 1:
                        startActivity(OpenglCamera2PreviewActivity.class);
                        break;
                    case 2:
                        startActivity(OpenglCameraRotatePreviewActivity.class);
                        break;
                    case 3:
                        startActivity(OpenglCameraRotateTexturePreviewActivity.class);
                        break;
                    case 4:
                        startActivity(OpenglCameraScaleTexturePreviewActivity.class);
                        break;
                    case 5:
                        startActivity(TextWaterMarkPreviewActivity.class);
                        break;
                    case 6:
                        startActivity(TextWaterMarkFBOPreviewActivity.class);
                        break;
                    case 7:
                        startActivity(BlackWhiteFBOPreviewActivity.class);
                        break;

                }
            }
        });

        rvOpenglAdvanced.setAdapter(openGLCourseAdapter);
    }
}
